package org.csmz.class2333;

class YieldThread extends Thread{
    public YieldThread(String name){
        super(name);
    }
    @Override
    public void run(){
        for (int i=1;i<4;i++){
            String threadName = Thread.currentThread().getName();
            if (i == 2) {
                System.out.println(threadName+"线程让步！");
                Thread.yield();
            }
            System.out.println(threadName+"---"+i);
        }
    }
}
